<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div>
    <div>
      <a href="#/index">首页</a> |
      <a href="#/person">我的</a> |
    </div>
    <div class="content"></div>
  </div>

  <script>
    // 首页的布局
    const homePage = `
      <h1>我是首页</h1>
    `

    // 个人中心
    const profilePage = `
      <h2>个人中心页面</h2>
    `
  </script>


  <script>
    const content = document.querySelector('.content')
    window.onhashchange = function() {
      console.log('hash change....', window.location.hash, 'test')
      switch(window.location.hash) {
        case '#/index':
          content.innerHTML = homePage
          break
        case '#/person':
          content.innerHTML = profilePage
          break
      }
    }
  </script>
</body>
</html>